<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace app\common\logic\admin;

use app\common\model\TemplateFooterModel;

class TemplateFooter
{
	private $mTemplateFooter;
	public function __construct(){
		$this->mTemplateFooter = new TemplateFooterModel();
	}
	public function save($param,$status = 1){
		
		$data['num'] = count($param['post']['content']);
		$data['content'] = json_encode($param['post']['content']);
		$data['name'] = $param['post']['name'];
		if(!empty($param['post']['user_id'])){
			$data['user_id'] = $param['post']['user_id'];
		}
		switch ($status) {
			case 1:
				$rs = $this->mTemplateFooter->save($data);
				break;
			case 2:
				$rs = $this->mTemplateFooter->save($data,['footer_id'=>$param['footer_id']]);
				break;

		}
		return $rs;
		
	}
}